import { Node, Shape } from "@antv/x6";
import { nextId } from '../utils';
import { defaultPortGroup } from './_default';

export default class InclusiveGateway extends Shape.Polygon{
  private static default:Node.Metadata = {
    width: 60,
    height: 60,
    attrs: {
      body: {
        refPoints: '0,10 10,0 20,10 10,20',
        strokeWidth: 2,
        stroke: '#5F95FF',
        fill: '#EFF4FF',
      },
      label: {
        text: 'o',
        fontSize: 40,
        fill: '#5F95FF',
      },
    },
    ports: {
      groups: {
        top: { ...defaultPortGroup, position: "top" },
        right: { ...defaultPortGroup, position: "right" },
        bottom: { ...defaultPortGroup, position: "bottom" },
        left: { ...defaultPortGroup, position: "left" }
      },
      items: [
        { id: "P0_0", group: "top" },
        { id: "P1_0", group: "right" },
        { id: "P2_0", group: "bottom" },
        { id: "P3_0", group: "left" },
      ],
    }
  }
  private static complement = (metadata: Node.Metadata={}):Node.Metadata=>{
    metadata.id = metadata.id || nextId();
    return Object.assign({},InclusiveGateway.default,metadata);
  }

  constructor(metadata: Node.Metadata={}){
    super(InclusiveGateway.complement(metadata));
  }

}
